<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html
    PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<!-- /fasttmp/mkdist-qt-4.3.5-1211793125/qtopia-core-opensource-src-4.3.5/src/opengl/qgl.cpp -->
<head>
  <title>Qt 4.3: QGLFormat Class Reference</title>
  <link href="classic.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td align="left" valign="top" width="32"><a href="http://www.trolltech.com/products/qt"><img src="images/qt-logo.png" align="left" width="32" height="32" border="0" /></a></td>
<td width="1">&nbsp;&nbsp;</td><td class="postheader" valign="center"><a href="index.html"><font color="#004faf">Home</font></a>&nbsp;&middot; <a href="classes.html"><font color="#004faf">All&nbsp;Classes</font></a>&nbsp;&middot; <a href="mainclasses.html"><font color="#004faf">Main&nbsp;Classes</font></a>&nbsp;&middot; <a href="groups.html"><font color="#004faf">Grouped&nbsp;Classes</font></a>&nbsp;&middot; <a href="modules.html"><font color="#004faf">Modules</font></a>&nbsp;&middot; <a href="functions.html"><font color="#004faf">Functions</font></a></td>
<td align="right" valign="top" width="230"><a href="http://www.trolltech.com"><img src="images/trolltech-logo.png" align="right" width="203" height="32" border="0" /></a></td></tr></table><h1 align="center">QGLFormat Class Reference<br /><sup><sup>[<a href="qtopengl.html">QtOpenGL</a> module]</sup></sup></h1>
<p>The QGLFormat class specifies the display format of an OpenGL rendering context. <a href="#details">More...</a></p>
<pre> #include &lt;QGLFormat&gt;</pre><ul>
<li><a href="qglformat-members.html">List of all members, including inherited members</a></li>
</ul>
<a name="public-types"></a>
<h3>Public Types</h3>
<ul>
<li><div class="fn"/>enum <b><a href="qglformat.html#OpenGLVersionFlag-enum">OpenGLVersionFlag</a></b> { OpenGL_Version_None, OpenGL_Version_1_1, OpenGL_Version_1_2, OpenGL_Version_1_3, ..., OpenGL_ES_Version_2_0 }</li>
<li><div class="fn"/>flags <b><a href="qglformat.html#OpenGLVersionFlag-enum">OpenGLVersionFlags</a></b></li>
</ul>
<a name="public-functions"></a>
<h3>Public Functions</h3>
<ul>
<li><div class="fn"/><b><a href="qglformat.html#QGLFormat">QGLFormat</a></b> ()</li>
<li><div class="fn"/><b><a href="qglformat.html#QGLFormat-2">QGLFormat</a></b> ( QGL::FormatOptions <i>options</i>, int <i>plane</i> = 0 )</li>
<li><div class="fn"/><b><a href="qglformat.html#QGLFormat-3">QGLFormat</a></b> ( const QGLFormat &amp; <i>other</i> )</li>
<li><div class="fn"/><b><a href="qglformat.html#dtor.QGLFormat">~QGLFormat</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#accum">accum</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#accumBufferSize">accumBufferSize</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#alpha">alpha</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#alphaBufferSize">alphaBufferSize</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#blueBufferSize">blueBufferSize</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#depth">depth</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#depthBufferSize">depthBufferSize</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#directRendering">directRendering</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#doubleBuffer">doubleBuffer</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#greenBufferSize">greenBufferSize</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#hasOverlay">hasOverlay</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#plane">plane</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#redBufferSize">redBufferSize</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#rgba">rgba</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#sampleBuffers">sampleBuffers</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#samples">samples</a></b> () const</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setAccum">setAccum</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setAlpha">setAlpha</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setDepth">setDepth</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setDirectRendering">setDirectRendering</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setOption">setOption</a></b> ( QGL::FormatOptions <i>opt</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setOverlay">setOverlay</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setPlane">setPlane</a></b> ( int <i>plane</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setRedBufferSize">setRedBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setRgba">setRgba</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setSampleBuffers">setSampleBuffers</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setSamples">setSamples</a></b> ( int <i>numSamples</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setStencil">setStencil</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a></b> ( int <i>size</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setStereo">setStereo</a></b> ( bool <i>enable</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setSwapInterval">setSwapInterval</a></b> ( int <i>interval</i> )</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#stencil">stencil</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#stencilBufferSize">stencilBufferSize</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#stereo">stereo</a></b> () const</li>
<li><div class="fn"/>int <b><a href="qglformat.html#swapInterval">swapInterval</a></b> () const</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#testOption">testOption</a></b> ( QGL::FormatOptions <i>opt</i> ) const</li>
<li><div class="fn"/>QGLFormat &amp; <b><a href="qglformat.html#operator-eq">operator=</a></b> ( const QGLFormat &amp; <i>other</i> )</li>
</ul>
<a name="static-public-members"></a>
<h3>Static Public Members</h3>
<ul>
<li><div class="fn"/>QGLFormat <b><a href="qglformat.html#defaultFormat">defaultFormat</a></b> ()</li>
<li><div class="fn"/>QGLFormat <b><a href="qglformat.html#defaultOverlayFormat">defaultOverlayFormat</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#hasOpenGL">hasOpenGL</a></b> ()</li>
<li><div class="fn"/>bool <b><a href="qglformat.html#hasOpenGLOverlays">hasOpenGLOverlays</a></b> ()</li>
<li><div class="fn"/>OpenGLVersionFlags <b><a href="qglformat.html#openGLVersionFlags">openGLVersionFlags</a></b> ()</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setDefaultFormat">setDefaultFormat</a></b> ( const QGLFormat &amp; <i>f</i> )</li>
<li><div class="fn"/>void <b><a href="qglformat.html#setDefaultOverlayFormat">setDefaultOverlayFormat</a></b> ( const QGLFormat &amp; <i>f</i> )</li>
</ul>
<a name="details"></a>
<hr />
<h2>Detailed Description</h2>
<p>The QGLFormat class specifies the display format of an OpenGL rendering context.</p>
<p>A display format has several characteristics:</p>
<ul>
<li><a href="qglformat.html#setDoubleBuffer">Double or single buffering.</a></li>
<li><a href="qglformat.html#setDepth">Depth buffer.</a></li>
<li><a href="qglformat.html#setRgba">RGBA or color index mode.</a></li>
<li><a href="qglformat.html#setAlpha">Alpha channel.</a></li>
<li><a href="qglformat.html#setAccum">Accumulation buffer.</a></li>
<li><a href="qglformat.html#setStencil">Stencil buffer.</a></li>
<li><a href="qglformat.html#setStereo">Stereo buffers.</a></li>
<li><a href="qglformat.html#setDirectRendering">Direct rendering.</a></li>
<li><a href="qglformat.html#setOverlay">Presence of an overlay.</a></li>
<li><a href="qglformat.html#setPlane">The plane of an overlay format.</a></li>
<li><a href="qglformat.html#setSampleBuffers">Multisample buffers.</a></li>
</ul>
<p>You can also specify preferred bit depths for the depth buffer, alpha buffer, accumulation buffer and the stencil buffer with the functions: <a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>(), <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>(), <a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>() and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
<p>Note that even if you specify that you prefer a 32 bit depth buffer (e.g&#x2e; with setDepthBufferSize(32)), the format that is chosen may not have a 32 bit depth buffer, even if there is a format available with a 32 bit depth buffer. The main reason for this is how the system dependant picking algorithms work on the different platforms, and some format options may have higher precedence than others.</p>
<p>You create and tell a QGLFormat object what rendering options you want from an OpenGL rendering context.</p>
<p>OpenGL drivers or accelerated hardware may or may not support advanced features such as alpha channel or stereographic viewing. If you request some features that the driver/hardware does not provide when you create a <a href="qglwidget.html">QGLWidget</a>, you will get a rendering context with the nearest subset of features.</p>
<p>There are different ways to define the display characteristics of a rendering context. One is to create a QGLFormat and make it the default for the entire application:</p>
<pre> QGLFormat fmt;
 fmt.setAlpha(true);
 fmt.setStereo(true);
 QGLFormat::setDefaultFormat(fmt);</pre>
<p>Or you can specify the desired format when creating an object of your <a href="qglwidget.html">QGLWidget</a> subclass:</p>
<pre> QGLFormat fmt;
 fmt.setDoubleBuffer(false);                 <span class="comment">//</span> single buffer
 fmt.setDirectRendering(false);              <span class="comment">//</span> software rendering
 MyGLWidget* myWidget = new MyGLWidget(fmt, ...);</pre>
<p>After the widget has been created, you can find out which of the requested features the system was able to provide:</p>
<pre> QGLFormat fmt;
 fmt.setOverlay(true);
 fmt.setStereo(true);
 MyGLWidget* myWidget = new MyGLWidget(fmt, ...);
 if (!myWidget-&gt;format().stereo()) {
     <span class="comment">//</span> ok, goggles off
     if (!myWidget-&gt;format().hasOverlay()) {
         qFatal(&quot;Cool hardware required&quot;);
     }
 }</pre>
<div style="padding: 0.5em; background: #e0e0e0; color: black"><p>OpenGL is a trademark of Silicon Graphics, Inc. in the United States and other countries.</p>
</div><p>See also <a href="qglcontext.html">QGLContext</a> and <a href="qglwidget.html">QGLWidget</a>.</p>
<hr />
<h2>Member Type Documentation</h2>
<h3 class="flags"><a name="OpenGLVersionFlag-enum"></a>enum QGLFormat::OpenGLVersionFlag<br />flags QGLFormat::OpenGLVersionFlags</h3>
<p>This enum describes the various OpenGL versions that are recognized by Qt. Use the <a href="qglformat.html#openGLVersionFlags">QGLFormat::openGLVersionFlags</a>() function to identify which versions that are supported at runtime.</p>
<p><table border="1" cellpadding="2" cellspacing="1" width="100%">
<tr><th width="25%">Constant</th><th width="15%">Value</th><th width="60%">Description</th></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_None</tt></td><td align="center" valign="top"><tt>0x00000000</tt></td><td valign="top">If no OpenGL is present or if no OpenGL context is current.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_1_1</tt></td><td align="center" valign="top"><tt>0x00000001</tt></td><td valign="top">OpenGL version 1.1 or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_1_2</tt></td><td align="center" valign="top"><tt>0x00000002</tt></td><td valign="top">OpenGL version 1.2 or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_1_3</tt></td><td align="center" valign="top"><tt>0x00000004</tt></td><td valign="top">OpenGL version 1.3 or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_1_4</tt></td><td align="center" valign="top"><tt>0x00000008</tt></td><td valign="top">OpenGL version 1.4 or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_1_5</tt></td><td align="center" valign="top"><tt>0x00000010</tt></td><td valign="top">OpenGL version 1.5 or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_2_0</tt></td><td align="center" valign="top"><tt>0x00000020</tt></td><td valign="top">OpenGL version 2.0 or higher is present. Note that version 2.0 supports all the functionality of version 1.5&#x2e;</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_Version_2_1</tt></td><td align="center" valign="top"><tt>0x00000040</tt></td><td valign="top">OpenGL version 2.1 or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_ES_CommonLite_Version_1_0</tt></td><td align="center" valign="top"><tt>0x00000100</tt></td><td valign="top">OpenGL ES version 1.0 Common Lite or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_ES_Common_Version_1_0</tt></td><td align="center" valign="top"><tt>0x00000080</tt></td><td valign="top">OpenGL ES version 1.0 Common or higher is present. The Common profile supports all the features of Common Lite.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_ES_CommonLite_Version_1_1</tt></td><td align="center" valign="top"><tt>0x00000400</tt></td><td valign="top">OpenGL ES version 1.1 Common Lite or higher is present.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_ES_Common_Version_1_1</tt></td><td align="center" valign="top"><tt>0x00000200</tt></td><td valign="top">OpenGL ES version 1.1 Common or higher is present. The Common profile supports all the features of Common Lite.</td></tr>
<tr><td valign="top"><tt>QGLFormat::OpenGL_ES_Version_2_0</tt></td><td align="center" valign="top"><tt>0x00000800</tt></td><td valign="top">OpenGL ES version 2.0 or higher is present. Note that OpenGL ES version 2.0 does not support all the features of OpenGL ES 1.x&#x2e; So if OpenGL_ES_Version_2_0 is returned, none of the ES 1.x flags are returned.</td></tr>
</table></p>
<p>See also <a href="http://www.opengl.org">http://www.opengl.org</a> for more information about the different revisions of OpenGL.</p>
<p>This enum was introduced in Qt 4.2.</p>
<p>The OpenGLVersionFlags type is a typedef for <a href="qflags.html">QFlags</a>&lt;OpenGLVersionFlag&gt;. It stores an OR combination of OpenGLVersionFlag values.</p>
<p>See also <a href="qglformat.html#openGLVersionFlags">openGLVersionFlags</a>().</p>
<hr />
<h2>Member Function Documentation</h2>
<h3 class="fn"><a name="QGLFormat"></a>QGLFormat::QGLFormat ()</h3>
<p>Constructs a <a href="qglformat.html">QGLFormat</a> object with the factory default settings:</p>
<ul>
<li><a href="qglformat.html#setDoubleBuffer">Double buffer:</a> Enabled.</li>
<li><a href="qglformat.html#setDepth">Depth buffer:</a> Enabled.</li>
<li><a href="qglformat.html#setRgba">RGBA:</a> Enabled (i.e&#x2e;, color index disabled).</li>
<li><a href="qglformat.html#setAlpha">Alpha channel:</a> Disabled.</li>
<li><a href="qglformat.html#setAccum">Accumulator buffer:</a> Disabled.</li>
<li><a href="qglformat.html#setStencil">Stencil buffer:</a> Disabled.</li>
<li><a href="qglformat.html#setStereo">Stereo:</a> Disabled.</li>
<li><a href="qglformat.html#setDirectRendering">Direct rendering:</a> Enabled.</li>
<li><a href="qglformat.html#setOverlay">Overlay:</a> Disabled.</li>
<li><a href="qglformat.html#setPlane">Plane:</a> 0 (i.e&#x2e;, normal plane).</li>
<li><a href="qglformat.html#setSampleBuffers">Multisample buffers:</a> Disabled.</li>
</ul>
<h3 class="fn"><a name="QGLFormat-2"></a>QGLFormat::QGLFormat ( <a href="qgl.html#FormatOption-enum">QGL::FormatOptions</a> <i>options</i>, int <i>plane</i> = 0 )</h3>
<p>Creates a <a href="qglformat.html">QGLFormat</a> object that is a copy of the current <a href="qglformat.html#defaultFormat">application default format</a>.</p>
<p>If <i>options</i> is not 0, this copy is modified by these format options. The <i>options</i> parameter should be <tt>FormatOption</tt> values OR'ed together.</p>
<p>This constructor makes it easy to specify a certain desired format in classes derived from <a href="qglwidget.html">QGLWidget</a>, for example:</p>
<pre><span class="comment"> //</span> The rendering in MyGLWidget depends on using
<span class="comment"> //</span> stencil buffer and alpha channel
 MyGLWidget::MyGLWidget(QWidget* parent)
     : QGLWidget(QGLFormat(QGL::StencilBuffer | QGL::AlphaChannel), parent)
 {
     if (!format().stencil())
         qWarning(&quot;Could not get stencil buffer; results will be suboptimal&quot;);
     if (!format().alpha())
         qWarning(&quot;Could not get alpha channel; results will be suboptimal&quot;);
     ...
 }</pre>
<p>Note that there are <tt>FormatOption</tt> values to turn format settings both on and off, e.g&#x2e; <tt>DepthBuffer</tt> and <tt>NoDepthBuffer</tt>, <tt>DirectRendering</tt> and <tt>IndirectRendering</tt>, etc.</p>
<p>The <i>plane</i> parameter defaults to 0 and is the plane which this format should be associated with. Not all OpenGL implementations supports overlay/underlay rendering planes.</p>
<p>See also <a href="qglformat.html#defaultFormat">defaultFormat</a>() and <a href="qglformat.html#setOption">setOption</a>().</p>
<h3 class="fn"><a name="QGLFormat-3"></a>QGLFormat::QGLFormat ( const QGLFormat &amp; <i>other</i> )</h3>
<p>Constructs a copy of <i>other</i>.</p>
<h3 class="fn"><a name="dtor.QGLFormat"></a>QGLFormat::~QGLFormat ()</h3>
<p>Destroys the <a href="qglformat.html">QGLFormat</a>.</p>
<h3 class="fn"><a name="accum"></a>bool QGLFormat::accum () const</h3>
<p>Returns true if the accumulation buffer is enabled; otherwise returns false. The accumulation buffer is disabled by default.</p>
<p>See also <a href="qglformat.html#setAccum">setAccum</a>() and <a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>().</p>
<h3 class="fn"><a name="accumBufferSize"></a>int QGLFormat::accumBufferSize () const</h3>
<p>Returns the accumulation buffer size.</p>
<p>See also <a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>(), <a href="qglformat.html#accum">accum</a>(), and <a href="qglformat.html#setAccum">setAccum</a>().</p>
<h3 class="fn"><a name="alpha"></a>bool QGLFormat::alpha () const</h3>
<p>Returns true if the alpha buffer in the framebuffer is enabled; otherwise returns false. The alpha buffer is disabled by default.</p>
<p>See also <a href="qglformat.html#setAlpha">setAlpha</a>() and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
<h3 class="fn"><a name="alphaBufferSize"></a>int QGLFormat::alphaBufferSize () const</h3>
<p>Returns the alpha buffer size.</p>
<p>See also <a href="qglformat.html#alpha">alpha</a>(), <a href="qglformat.html#setAlpha">setAlpha</a>(), and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
<h3 class="fn"><a name="blueBufferSize"></a>int QGLFormat::blueBufferSize () const</h3>
<p>Returns the blue buffer size.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>().</p>
<h3 class="fn"><a name="defaultFormat"></a>QGLFormat QGLFormat::defaultFormat ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the default <a href="qglformat.html">QGLFormat</a> for the application. All QGLWidgets that are created use this format unless another format is specified, e.g&#x2e; when they are constructed.</p>
<p>If no special default format has been set using <a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>(), the default format is the same as that created with <a href="qglformat.html#QGLFormat">QGLFormat</a>().</p>
<p>See also <a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>().</p>
<h3 class="fn"><a name="defaultOverlayFormat"></a>QGLFormat QGLFormat::defaultOverlayFormat ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns the default <a href="qglformat.html">QGLFormat</a> for overlay contexts.</p>
<p>The factory default overlay format is:</p>
<ul>
<li><a href="qglformat.html#setDoubleBuffer">Double buffer:</a> Disabled.</li>
<li><a href="qglformat.html#setDepth">Depth buffer:</a> Disabled.</li>
<li><a href="qglformat.html#setRgba">RGBA:</a> Disabled (i.e&#x2e;, color index enabled).</li>
<li><a href="qglformat.html#setAlpha">Alpha channel:</a> Disabled.</li>
<li><a href="qglformat.html#setAccum">Accumulator buffer:</a> Disabled.</li>
<li><a href="qglformat.html#setStencil">Stencil buffer:</a> Disabled.</li>
<li><a href="qglformat.html#setStereo">Stereo:</a> Disabled.</li>
<li><a href="qglformat.html#setDirectRendering">Direct rendering:</a> Enabled.</li>
<li><a href="qglformat.html#setOverlay">Overlay:</a> Disabled.</li>
<li><a href="qglformat.html#setPlane">Plane:</a> 1 (i.e&#x2e;, first overlay plane).</li>
</ul>
<p>See also <a href="qglformat.html#setDefaultOverlayFormat">setDefaultOverlayFormat</a>() and <a href="qglformat.html#setDefaultFormat">setDefaultFormat</a>().</p>
<h3 class="fn"><a name="depth"></a>bool QGLFormat::depth () const</h3>
<p>Returns true if the depth buffer is enabled; otherwise returns false. The depth buffer is enabled by default.</p>
<p>See also <a href="qglformat.html#setDepth">setDepth</a>() and <a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>().</p>
<h3 class="fn"><a name="depthBufferSize"></a>int QGLFormat::depthBufferSize () const</h3>
<p>Returns the depth buffer size.</p>
<p>See also <a href="qglformat.html#depth">depth</a>(), <a href="qglformat.html#setDepth">setDepth</a>(), and <a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>().</p>
<h3 class="fn"><a name="directRendering"></a>bool QGLFormat::directRendering () const</h3>
<p>Returns true if direct rendering is enabled; otherwise returns false.</p>
<p>Direct rendering is enabled by default.</p>
<p>See also <a href="qglformat.html#setDirectRendering">setDirectRendering</a>().</p>
<h3 class="fn"><a name="doubleBuffer"></a>bool QGLFormat::doubleBuffer () const</h3>
<p>Returns true if double buffering is enabled; otherwise returns false. Double buffering is enabled by default.</p>
<p>See also <a href="qglformat.html#setDoubleBuffer">setDoubleBuffer</a>().</p>
<h3 class="fn"><a name="greenBufferSize"></a>int QGLFormat::greenBufferSize () const</h3>
<p>Returns the green buffer size.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>().</p>
<h3 class="fn"><a name="hasOpenGL"></a>bool QGLFormat::hasOpenGL ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns true if the window system has any OpenGL support; otherwise returns false.</p>
<p><b>Warning:</b> This function must not be called until the <a href="qapplication.html">QApplication</a> object has been created.</p>
<h3 class="fn"><a name="hasOpenGLOverlays"></a>bool QGLFormat::hasOpenGLOverlays ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Returns true if the window system supports OpenGL overlays; otherwise returns false.</p>
<p><b>Warning:</b> This function must not be called until the <a href="qapplication.html">QApplication</a> object has been created.</p>
<h3 class="fn"><a name="hasOverlay"></a>bool QGLFormat::hasOverlay () const</h3>
<p>Returns true if overlay plane is enabled; otherwise returns false.</p>
<p>Overlay is disabled by default.</p>
<p>See also <a href="qglformat.html#setOverlay">setOverlay</a>().</p>
<h3 class="fn"><a name="openGLVersionFlags"></a><a href="qglformat.html#OpenGLVersionFlag-enum">OpenGLVersionFlags</a> QGLFormat::openGLVersionFlags ()&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Identifies, at runtime, which OpenGL versions that are supported by the current platform.</p>
<p>Note that if OpenGL version 1.5 is supported, its predecessors (i.e&#x2e;, version 1.4 and lower) are also supported. To identify the support of a particular feature, like multi texturing, test for the version in which the feature was first introduced (i.e&#x2e;, version 1.3 in the case of multi texturing) to adapt to the largest possible group of runtime platforms.</p>
<p>This function needs a valid current OpenGL context to work; otherwise it will return <a href="qglformat.html#OpenGLVersionFlag-enum">OpenGL_Version_None</a>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#hasOpenGL">hasOpenGL</a>() and <a href="qglformat.html#hasOpenGLOverlays">hasOpenGLOverlays</a>().</p>
<h3 class="fn"><a name="plane"></a>int QGLFormat::plane () const</h3>
<p>Returns the plane of this format. The default for normal formats is 0, which means the normal plane. The default for overlay formats is 1, which is the first overlay plane.</p>
<p>See also <a href="qglformat.html#setPlane">setPlane</a>().</p>
<h3 class="fn"><a name="redBufferSize"></a>int QGLFormat::redBufferSize () const</h3>
<p>Returns the red buffer size.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>().</p>
<h3 class="fn"><a name="rgba"></a>bool QGLFormat::rgba () const</h3>
<p>Returns true if RGBA color mode is set. Returns false if color index mode is set. The default color mode is RGBA.</p>
<p>See also <a href="qglformat.html#setRgba">setRgba</a>().</p>
<h3 class="fn"><a name="sampleBuffers"></a>bool QGLFormat::sampleBuffers () const</h3>
<p>Returns true if multisample buffer support is enabled; otherwise returns false.</p>
<p>The multisample buffer is disabled by default.</p>
<p>See also <a href="qglformat.html#setSampleBuffers">setSampleBuffers</a>().</p>
<h3 class="fn"><a name="samples"></a>int QGLFormat::samples () const</h3>
<p>Returns the number of samples per pixel when multisampling is enabled. By default, the highest number of samples that is available is used.</p>
<p>See also <a href="qglformat.html#setSampleBuffers">setSampleBuffers</a>(), <a href="qglformat.html#sampleBuffers">sampleBuffers</a>(), and <a href="qglformat.html#setSamples">setSamples</a>().</p>
<h3 class="fn"><a name="setAccum"></a>void QGLFormat::setAccum ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables the accumulation buffer; otherwise disables the accumulation buffer.</p>
<p>The accumulation buffer is disabled by default.</p>
<p>The accumulation buffer is used to create blur effects and multiple exposures.</p>
<p>See also <a href="qglformat.html#accum">accum</a>() and <a href="qglformat.html#setAccumBufferSize">setAccumBufferSize</a>().</p>
<h3 class="fn"><a name="setAccumBufferSize"></a>void QGLFormat::setAccumBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred accumulation buffer size, where <i>size</i> is the bit depth for each RGBA component.</p>
<p>See also <a href="qglformat.html#accum">accum</a>(), <a href="qglformat.html#setAccum">setAccum</a>(), and <a href="qglformat.html#accumBufferSize">accumBufferSize</a>().</p>
<h3 class="fn"><a name="setAlpha"></a>void QGLFormat::setAlpha ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables the alpha buffer; otherwise disables the alpha buffer.</p>
<p>The alpha buffer is disabled by default.</p>
<p>The alpha buffer is typically used for implementing transparency or translucency. The A in RGBA specifies the transparency of a pixel.</p>
<p>See also <a href="qglformat.html#alpha">alpha</a>() and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
<h3 class="fn"><a name="setAlphaBufferSize"></a>void QGLFormat::setAlphaBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred alpha buffer size to <i>size</i>. This function implicitly enables the alpha channel.</p>
<p>See also <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(), and <a href="qglformat.html#alphaBufferSize">alphaBufferSize</a>().</p>
<h3 class="fn"><a name="setBlueBufferSize"></a>void QGLFormat::setBlueBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred blue buffer size to <i>size</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#blueBufferSize">blueBufferSize</a>(), <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(), and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
<h3 class="fn"><a name="setDefaultFormat"></a>void QGLFormat::setDefaultFormat ( const QGLFormat &amp; <i>f</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Sets a new default <a href="qglformat.html">QGLFormat</a> for the application to <i>f</i>. For example, to set single buffering as the default instead of double buffering, your main() might contain code like this:</p>
<pre> QApplication a(argc, argv);
 QGLFormat f;
 f.setDoubleBuffer(false);
 QGLFormat::setDefaultFormat(f);</pre>
<p>See also <a href="qglformat.html#defaultFormat">defaultFormat</a>().</p>
<h3 class="fn"><a name="setDefaultOverlayFormat"></a>void QGLFormat::setDefaultOverlayFormat ( const QGLFormat &amp; <i>f</i> )&nbsp;&nbsp;<tt> [static]</tt></h3>
<p>Sets a new default <a href="qglformat.html">QGLFormat</a> for overlay contexts to <i>f</i>. This format is used whenever a <a href="qglwidget.html">QGLWidget</a> is created with a format that <a href="qglformat.html#hasOverlay">hasOverlay</a>() enabled.</p>
<p>For example, to get a double buffered overlay context (if available), use code like this:</p>
<pre> QGLFormat f = QGLFormat::defaultOverlayFormat();
 f.setDoubleBuffer(true);
 QGLFormat::setDefaultOverlayFormat(f);</pre>
<p>As usual, you can find out after widget creation whether the underlying OpenGL system was able to provide the requested specification:</p>
<pre><span class="comment"> //</span> ...continued from above
 MyGLWidget* myWidget = new MyGLWidget(QGLFormat(QGL::HasOverlay), ...);
 if (myWidget-&gt;format().hasOverlay()) {
     <span class="comment">//</span> Yes, we got an overlay, let's check _its_ format:
     QGLContext* olContext = myWidget-&gt;overlayContext();
     if (olContext-&gt;format().doubleBuffer())
         ; <span class="comment">//</span> yes, we got a double buffered overlay
     else
         ; <span class="comment">//</span> no, only single buffered overlays are available
 }</pre>
<p>See also <a href="qglformat.html#defaultOverlayFormat">defaultOverlayFormat</a>().</p>
<h3 class="fn"><a name="setDepth"></a>void QGLFormat::setDepth ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables the depth buffer; otherwise disables the depth buffer.</p>
<p>The depth buffer is enabled by default.</p>
<p>The purpose of a depth buffer (or Z-buffering) is to remove hidden surfaces. Pixels are assigned Z values based on the distance to the viewer. A pixel with a high Z value is closer to the viewer than a pixel with a low Z value. This information is used to decide whether to draw a pixel or not.</p>
<p>See also <a href="qglformat.html#depth">depth</a>() and <a href="qglformat.html#setDepthBufferSize">setDepthBufferSize</a>().</p>
<h3 class="fn"><a name="setDepthBufferSize"></a>void QGLFormat::setDepthBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred depth buffer size to <i>size</i>.</p>
<p>See also <a href="qglformat.html#depthBufferSize">depthBufferSize</a>(), <a href="qglformat.html#setDepth">setDepth</a>(), and <a href="qglformat.html#depth">depth</a>().</p>
<h3 class="fn"><a name="setDirectRendering"></a>void QGLFormat::setDirectRendering ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables direct rendering; otherwise disables direct rendering.</p>
<p>Direct rendering is enabled by default.</p>
<p>Enabling this option will make OpenGL bypass the underlying window system and render directly from hardware to the screen, if this is supported by the system.</p>
<p>See also <a href="qglformat.html#directRendering">directRendering</a>().</p>
<h3 class="fn"><a name="setDoubleBuffer"></a>void QGLFormat::setDoubleBuffer ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true sets double buffering; otherwise sets single buffering.</p>
<p>Double buffering is enabled by default.</p>
<p>Double buffering is a technique where graphics are rendered on an off-screen buffer and not directly to the screen. When the drawing has been completed, the program calls a swapBuffers() function to exchange the screen contents with the buffer. The result is flicker-free drawing and often better performance.</p>
<p>See also <a href="qglformat.html#doubleBuffer">doubleBuffer</a>(), <a href="qglcontext.html#swapBuffers">QGLContext::swapBuffers</a>(), and <a href="qglwidget.html#swapBuffers">QGLWidget::swapBuffers</a>().</p>
<h3 class="fn"><a name="setGreenBufferSize"></a>void QGLFormat::setGreenBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred green buffer size to <i>size</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#greenBufferSize">greenBufferSize</a>(), <a href="qglformat.html#setRedBufferSize">setRedBufferSize</a>(), <a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>(), and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
<h3 class="fn"><a name="setOption"></a>void QGLFormat::setOption ( <a href="qgl.html#FormatOption-enum">QGL::FormatOptions</a> <i>opt</i> )</h3>
<p>Sets the format option to <i>opt</i>.</p>
<p>See also <a href="qglformat.html#testOption">testOption</a>().</p>
<h3 class="fn"><a name="setOverlay"></a>void QGLFormat::setOverlay ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables an overlay plane; otherwise disables the overlay plane.</p>
<p>Enabling the overlay plane will cause <a href="qglwidget.html">QGLWidget</a> to create an additional context in an overlay plane. See the <a href="qglwidget.html">QGLWidget</a> documentation for further information.</p>
<p>See also <a href="qglformat.html#hasOverlay">hasOverlay</a>().</p>
<h3 class="fn"><a name="setPlane"></a>void QGLFormat::setPlane ( int <i>plane</i> )</h3>
<p>Sets the requested plane to <i>plane</i>. 0 is the normal plane, 1 is the first overlay plane, 2 is the second overlay plane, etc.; -1, -2, etc. are underlay planes.</p>
<p>Note that in contrast to other format specifications, the plane specifications will be matched exactly. This means that if you specify a plane that the underlying OpenGL system cannot provide, an <a href="qglwidget.html#isValid">invalid</a> <a href="qglwidget.html">QGLWidget</a> will be created.</p>
<p>See also <a href="qglformat.html#plane">plane</a>().</p>
<h3 class="fn"><a name="setRedBufferSize"></a>void QGLFormat::setRedBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred red buffer size to <i>size</i>.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#redBufferSize">redBufferSize</a>(), <a href="qglformat.html#setGreenBufferSize">setGreenBufferSize</a>(), <a href="qglformat.html#setBlueBufferSize">setBlueBufferSize</a>(), and <a href="qglformat.html#setAlphaBufferSize">setAlphaBufferSize</a>().</p>
<h3 class="fn"><a name="setRgba"></a>void QGLFormat::setRgba ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true sets RGBA mode. If <i>enable</i> is false sets color index mode.</p>
<p>The default color mode is RGBA.</p>
<p>RGBA is the preferred mode for most OpenGL applications. In RGBA color mode you specify colors as red + green + blue + alpha quadruplets.</p>
<p>In color index mode you specify an index into a color lookup table.</p>
<p>See also <a href="qglformat.html#rgba">rgba</a>().</p>
<h3 class="fn"><a name="setSampleBuffers"></a>void QGLFormat::setSampleBuffers ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true, a GL context with multisample buffer support is picked; otherwise ignored.</p>
<p>See also <a href="qglformat.html#sampleBuffers">sampleBuffers</a>(), <a href="qglformat.html#setSamples">setSamples</a>(), and <a href="qglformat.html#samples">samples</a>().</p>
<h3 class="fn"><a name="setSamples"></a>void QGLFormat::setSamples ( int <i>numSamples</i> )</h3>
<p>Set the preferred number of samples per pixel when multisampling is enabled to <i>numSamples</i>. By default, the highest number of samples available is used.</p>
<p>See also <a href="qglformat.html#setSampleBuffers">setSampleBuffers</a>(), <a href="qglformat.html#sampleBuffers">sampleBuffers</a>(), and <a href="qglformat.html#samples">samples</a>().</p>
<h3 class="fn"><a name="setStencil"></a>void QGLFormat::setStencil ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables the stencil buffer; otherwise disables the stencil buffer.</p>
<p>The stencil buffer is disabled by default.</p>
<p>The stencil buffer masks certain parts of the drawing area so that masked parts are not drawn on.</p>
<p>See also <a href="qglformat.html#stencil">stencil</a>() and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
<h3 class="fn"><a name="setStencilBufferSize"></a>void QGLFormat::setStencilBufferSize ( int <i>size</i> )</h3>
<p>Set the preferred stencil buffer size to <i>size</i>.</p>
<p>See also <a href="qglformat.html#stencilBufferSize">stencilBufferSize</a>(), <a href="qglformat.html#setStencil">setStencil</a>(), and <a href="qglformat.html#stencil">stencil</a>().</p>
<h3 class="fn"><a name="setStereo"></a>void QGLFormat::setStereo ( bool <i>enable</i> )</h3>
<p>If <i>enable</i> is true enables stereo buffering; otherwise disables stereo buffering.</p>
<p>Stereo buffering is disabled by default.</p>
<p>Stereo buffering provides extra color buffers to generate left-eye and right-eye images.</p>
<p>See also <a href="qglformat.html#stereo">stereo</a>().</p>
<h3 class="fn"><a name="setSwapInterval"></a>void QGLFormat::setSwapInterval ( int <i>interval</i> )</h3>
<p>Set the preferred swap interval. This can be used to sync the GL drawing into a system window to the vertical refresh of the screen. Setting an <i>interval</i> value of 0 will turn the vertical refresh syncing off, any value higher than 0 will turn the vertical syncing on.</p>
<p>Under Windows, where the <tt>WGL_EXT_swap_control</tt> extension is used, the <i>interval</i> parameter can be used to set the minimum number of video frames that are displayed before a buffer swap will occur. In effect, setting the <i>interval</i> to 10, means there will be 10 vertical retraces between every buffer swap.</p>
<p>Note that setting the swap interval is only supported under Windows and on Mac OS X. Under Windows the <tt>WGL_EXT_swap_control</tt> extension has to be present.</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#swapInterval">swapInterval</a>().</p>
<h3 class="fn"><a name="stencil"></a>bool QGLFormat::stencil () const</h3>
<p>Returns true if the stencil buffer is enabled; otherwise returns false. The stencil buffer is disabled by default.</p>
<p>See also <a href="qglformat.html#setStencil">setStencil</a>() and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
<h3 class="fn"><a name="stencilBufferSize"></a>int QGLFormat::stencilBufferSize () const</h3>
<p>Returns the stencil buffer size.</p>
<p>See also <a href="qglformat.html#stencil">stencil</a>(), <a href="qglformat.html#setStencil">setStencil</a>(), and <a href="qglformat.html#setStencilBufferSize">setStencilBufferSize</a>().</p>
<h3 class="fn"><a name="stereo"></a>bool QGLFormat::stereo () const</h3>
<p>Returns true if stereo buffering is enabled; otherwise returns false. Stereo buffering is disabled by default.</p>
<p>See also <a href="qglformat.html#setStereo">setStereo</a>().</p>
<h3 class="fn"><a name="swapInterval"></a>int QGLFormat::swapInterval () const</h3>
<p>Returns the currently set swap interval. -1 is returned if setting the swap interval isn't supported in the system GL implementation (e.g&#x2e; under X11).</p>
<p>This function was introduced in Qt 4.2.</p>
<p>See also <a href="qglformat.html#setSwapInterval">setSwapInterval</a>().</p>
<h3 class="fn"><a name="testOption"></a>bool QGLFormat::testOption ( <a href="qgl.html#FormatOption-enum">QGL::FormatOptions</a> <i>opt</i> ) const</h3>
<p>Returns true if format option <i>opt</i> is set; otherwise returns false.</p>
<p>See also <a href="qglformat.html#setOption">setOption</a>().</p>
<h3 class="fn"><a name="operator-eq"></a>QGLFormat &amp; QGLFormat::operator= ( const QGLFormat &amp; <i>other</i> )</h3>
<p>Assigns <i>other</i> to this object.</p>
<p /><address><hr /><div align="center">
<table width="100%" cellspacing="0" border="0"><tr class="address">
<td width="30%">Copyright &copy; 2008 <a href="trolltech.html">Trolltech</a></td>
<td width="40%" align="center"><a href="trademarks.html">Trademarks</a></td>
<td width="30%" align="right"><div align="right">Qt 4.3.5</div></td>
</tr></table></div></address></body>
</html>
